The TADS Alternate Library
Version 2.0

Wrapper Functions


Copyright 2000 by Kevin Forchione.
This is part of the TADS Alternate Library Authors Manual.

Introduction and Table of Contents




Wrapper Functions

 

You must use these special wrapper functions instead of the TADS 2 built-in functions.

 

The following table shows the wrapper functions that must be used to help ensure the integrity of the display outcapturing and queuing mechanism.

 

Wrapper Function

built-in Function

askForDobj()

askdo()

askForIobj()

askio()

command()

execCommand()

inputLine()

input()

nestOutcapture()

outcapture()

quitGame()

quit()

undoTurn()

undo()

yesOrNo()

yorn()

 

The InputLine() function

 

The inputLine() wrapper will display any text being outcaptured before executing input() and resets the outcapturing after input().

 

 

The nestOutcapture() Function

 

Use the nestOutcapture() function, rather than the built-in outcapture() function. The nestOutcapture() function provides a convenient way to nest outcapturing.

 

          nestOutcapture(parm, term);

 

The arguments values are:

 

          parm: true    turn outcapturing on.

                   nil       retrieve current level of outcaptured data and turn outcapturing on.

 

term: true retrieves all nested levels of outcaptured data. Does not turn outcapturing on as this parameter is used to indicate that control is returned to the parser (by for example quitGame() or askForDobj()).

 

For example, this code:

 

        local str, str1, str2, str3;

       

        str = nestOutcapture(true);

        "This is the first-level ";

       

        str = nestOutcapture(true);

        "This is the second-level ";

       

        str = nestOutcapture(true);

        "This is the third-level outcapture [level 3]. ";

        str3 = nestOutcapture(nil);

       

        "outcapture [level 2]. ";

        str2 = nestOutcapture(nil);

        

        "outcapture [level 1]. ";

        str1 = nestOutcapture(nil);

       

        say(str1);

        say(str2);

        say(str3);

 

will produce the following display:

 

This is the first-level outcapture [level 1]. This is the second-level outcapture [level 2]. This is the third-level outcapture [level 3].